package com.example.basic.jsontest

import com.google.gson.Gson
import java.lang.reflect.Type
import com.example.basic.excels.User

import java.util.ArrayList

import com.google.gson.reflect.TypeToken




fun main() {
    val str = "{\n" +
            "\t\"code\": 401,\n" +
            "\t\"msg\": \"\",\n" +
            "\t\"data\": {\n" +
            "\t\t\"t1Id\": 46,\n" +
            "\t\t\"t1Title\": \"上午8:00 – 11:30\",\n" +
            "\t\t\"t1ForumCategory\": \"(2) 壇口經懺\",\n" +
            "\t\t\"t1ForumTitle\": \"法華壇  恭誦法華經 (臥佛殿)\",\n" +
            "\t\t\"t1Activity\": \"\",\n" +
            "\t\t\"t1StartLunar\": \"12月16日（四）十一月十三日\",\n" +
            "\t\t\"t1StartTime\": \"2021-12-16 08:00:00\",\n" +
            "\t\t\"t1EndTime\": \"2021-12-16 11:30:00\",\n" +
            "\t\t\"t2Id\": 60,\n" +
            "\t\t\"t2Title\": \"上午8:00 – 11:30\",\n" +
            "\t\t\"t2ForumCategory\": \"(2) 壇口經懺\",\n" +
            "\t\t\"t2ForumTitle\": \"楞嚴壇  恭誦楞嚴經 (念佛堂)\",\n" +
            "\t\t\"t2Activity\": \"\",\n" +
            "\t\t\"t2StartLunar\": \"12月16日（四）十一月十三日\",\n" +
            "\t\t\"t2StartTime\": \"2021-12-16 08:00:00\",\n" +
            "\t\t\"t2EndTime\": \"2021-12-16 11:30:00\"\n" +
            "\t}\n" +
            "}"
    val gson = Gson()
    val entity = gson.fromJson(str,BaseResponse::class.java)
    val result = gson.fromJson(gson.toJson(entity.data),LocalEntity::class.java)
    println(result.t1Id)
}